package com.fanghaoran.notes.controller;

import com.alibaba.fastjson.JSON;
import com.fanghaoran.notes.service.TypeService;
import com.fanghaoran.notes.service.impl.TypeServiceImpl;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;


/**
 * @Author: win11
 * @Date: 2023/04/18/17:58
 * @Description: 商品类型表现层
 */
@WebServlet("/type")
public class TypeController extends BaseServlet {

    /**
     * service对象
     */
    TypeService typeService = new TypeServiceImpl();

    /**
     * 查找所有的商品类型
     * @param request 请求
     * @param response 响应
     * @throws Exception 异常
     */
    public void findAllType(HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.getWriter().println(JSON.toJSONString(typeService.findAllType()));
    }
}
